 <%@page  import="org.opengeoingest.tufts.Layer.*, java.io.*, org.apache.commons.fileupload.disk.*, 
 org.apache.commons.fileupload.*, org.apache.commons.fileupload.servlet.*, java.util.*"%>
 
<jsp:include page="includes/header.jspf" />

<h3><center>Metadata Verification</center></h3>

<%

	DiskFileItemFactory factory = new DiskFileItemFactory();
	ServletFileUpload upload = new ServletFileUpload(factory);

	// Parse the request and get file items
	if (ServletFileUpload.isMultipartContent(request))
	{
		List items = upload.parseRequest(request);
		out.write("files uploaded = " + items.size());
		for (int i = 0 ; i < items.size() ; i++)
		{
			OutputStream solrStream = new ByteArrayOutputStream();
			DiskFileItem fgdcFile = (DiskFileItem)items.get(i);
			ToSolr converter = new ToSolr(fgdcFile, solrStream, "");
			//out.write("<p> verifying file name = " + fgdcFile.getName() + "</p>");
			
			InputStream inputStream = fgdcFile.getInputStream();
			Hashtable<BaseGeoParser.Key, Object> values = converter.convert();
			
			out.write("<p><h3> File: " + fgdcFile.getName() + "  </h3></p>");
			if (converter.missingTags != null)
			{
				Vector tags = converter.missingTags;
				if (tags.size() > 0)
				{
					out.write("<p>missing tags = ");
					for (int j = 0 ; j < tags.size() ; j++)
					{
						out.write(tags.get(j) + " " );
					}
					out.write("</p>");
				}
				else
				{
					out.write("<br/>no missing tags<br/>");
				}
				out.write("<br/><b>Summary Of Layer Values</b></center><br/>");
				String report = converter.getSolrReport(values);
				out.write("<p>" + report + "</p>");
			}
		}
	}
	else
	{
		out.write("<p>no file found</p>");
	}



%>

<jsp:include page="includes/footer.jspf" />
